Skip to content

Relay migrated simulation schema services from flow360-schema#2000

Merged
benflexcompute merged 11 commits intomainfrom
codex/simulation-schema-migration-batch-1-client-main-v2
Apr 19, 2026
Merged

Relay migrated simulation schema services from flow360-schema#2000
benflexcompute merged 11 commits intomainfrom
codex/simulation-schema-migration-batch-1-client-main-v2

Conversation

@benflexcompute
Copy link
Copy Markdown
Collaborator

@benflexcompute benflexcompute commented Apr 17, 2026

What changed

  • converted more of flow360/component/simulation/ into thin relays over schema-owned implementations
  • removed duplicate client implementations for migrated schema-owned logic, including validation service entry points, schema service helpers, updater helpers, conversion helpers, utils, and services_utils
  • removed duplicate client tests that now belong to schema ownership in the paired schema PR

Why

The migration target is for the client to keep runtime-only responsibilities such as translator orchestration, web API code, BET wrappers, and unit-switching, while schema owns Pydantic behavior, validation, and deserialization.

This PR is the final replacement client migration batch re-rooted onto the true current main.

Impact

  • client-side duplication is reduced substantially in this batch
  • schema-owned tests now live with the code they validate
  • the remaining client work is more clearly limited to runtime orchestration and a smaller set of residual case-by-case migrations

Validation

  • python -m py_compile flow360/component/simulation/services.py flow360/component/simulation/services_utils.py flow360/component/simulation/conversion.py flow360/component/simulation/utils.py flow360/component/simulation/framework/updater.py flow360/component/simulation/framework/updater_functions.py flow360/component/simulation/framework/updater_utils.py
  • targeted schema-side test suites were run in the paired schema PR for the migrated behavior
  • targeted client smoke tests were run during the migration for relay boundaries, but a full client pytest run was not used for this batch because the local client environment still had an older installed flow360-schema package during development

Paired Schema PR

  • flexcompute/flex#11404

Remaining Work From Plan

  • audit and shrink legacy unit_system.py / exposed_units.py only after confirming real remaining consumers
  • keep translator, BET request wrappers, web API code, process-json generation, and unit-switching orchestration on the client side
  • continue the remaining case-by-case cleanup in client tests and any residual helper boundaries, especially the still-mixed portions of tests/simulation/params/test_validators_params.py and tests/simulation/services/test_selector_expansion_validators.py
  • leave draft/project/web/runtime workflow tests on the client side unless a specific case proves to be pure schema behavior

Follow-up

This PR supersedes #1998 and #1999 for review against main. The remaining items should be finished in a follow-up PR rather than expanding this one further.


Note

Medium Risk
This rewires core simulation validation/updater/unit-conversion utilities to delegate to flow360-schema, so runtime behavior now depends on the bumped schema package and could change subtly across validation, migrations, and serialization boundaries.

Overview
Most of flow360/component/simulation/ is converted from local implementations into thin relay modules that re-export schema-owned logic (unit conversion helpers, updater orchestration and helpers, utility functions, and key service entry points like validate_model, defaults, and simulation-json update/apply helpers).

Client-owned duplicate logic and related reference fixtures/tests are removed, and the flow360-schema dependency is bumped to 25.10.2b1 to supply the migrated behavior.

Reviewed by Cursor Bugbot for commit 5ca8ca7. Bugbot is set up for automated code reviews on this repo. Configure here.

@benflexcompute benflexcompute changed the title [codex] Relay migrated simulation schema services from flow360-schema Relay migrated simulation schema services from flow360-schema Apr 17, 2026
Add `# pylint: disable=unused-import` to relay-only files whose
re-exported symbols are consumed by compute pipeline scripts.
Remove genuinely unused `materialize_entities_and_selectors_in_place`
import from services.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@benflexcompute benflexcompute marked this pull request as ready for review April 17, 2026 19:20
Keep only relay exports consumed by external compute scripts
(_parse_root_item_type_from_simulation_json, apply_simulation_setting_to_entity_info,
get_default_params, merge_geometry_entity_info, update_simulation_json).
Remove 15 symbols with no internal or external callers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Comment thread flow360/component/simulation/services.py
Comment thread flow360/component/simulation/services.py
Comment thread flow360/component/simulation/services.py
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

There are 4 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 355d0ef. Configure here.

Comment thread flow360/component/simulation/conversion.py
Comment thread flow360/component/simulation/framework/updater_utils.py
benflexcompute and others added 6 commits April 18, 2026 12:05
Schema package unified version handling via flow360_schema.__version__
(see plans/schema_version_unification.markdown); the constant no longer
exists in flow360_schema.models.simulation.framework.updater{,_utils}.
Drop the dead imports so pylint passes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
7 test modules import clear_context from services.py, and
test_value_or_expression.py also imports initialize_variable_space.
The relay cleanup dropped both, causing collection-time ImportError
on macOS CI. Re-add them from their schema-side origins.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PR 09a23b9 removed 'import flow360.component.simulation.units as u'
when deleting test_default_params_for_local_test, but two surviving
tests (test_mach_muref_op_cond, test_transformation_matrix) still
reference u.K / u.deg / u.m.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

Coverage report (flow360)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  flow360/component/simulation
  conversion.py
  services.py 529-530
  services_utils.py
  utils.py
  flow360/component/simulation/framework
  updater.py
  updater_functions.py 4
  updater_utils.py
  flow360/component/simulation/user_code/core
  types.py
Project Total  

This report was generated by python-coverage-comment-action

@benflexcompute benflexcompute enabled auto-merge (squash) April 19, 2026 15:52
@benflexcompute benflexcompute merged commit 6e0bf45 into main Apr 19, 2026
21 checks passed
@benflexcompute benflexcompute deleted the codex/simulation-schema-migration-batch-1-client-main-v2 branch April 19, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants